import request from "@/utils/request.js";

export default {
  //首页数据
  frontIndex(data) {
    return request.request({
      url: "/api/front/index",
      method: "get",
      data
    });
  },

  //获取商品列表
  product(type, data) {
    return request.request({
      url: `/api/front/index/product/${type}`,
      method: "get",
      data
    });
  },

  //获取商品列表
  menuUser(data) {
    return request.request({
      url: `/api/front/menu/user`,
      method: "get",
      data
    });
  },

  //优惠券
  getCoupons(data) {
    return request.request({
      url: `/api/front/coupons`,
      method: "get",
      data
    });
  },

  //商品详情
  productDetails(data) {
    return request.request({
      url: `/api/front/product/detail/${data}?type=normal`,
      method: "get",
      data
    });
  },

  //优品推荐
  getProductGood(data) {
    return request.request({
      url: `/api/front/product/good`,
      method: "get",
      data
    });
  },

  //评论信息
  getReply(data) {
    return request.request({
      url: `/api/front/reply/config/${data}`,
      method: "get",
      data
    });
  },

  //取消收藏
  collectDel(proId) {
    return request.request({
      url: `/api/front/collect/cancel/${proId}`,
      method: "post",
      data
    });
  },

  //添加收藏
  collectAdd(data) {
    return request.request({
      url: `/api/front/collect/add`,
      method: "post",
      data
    });
  },

  //分类列表
  category(data) {
    return request.request({
      url: `/api/front/category`,
      method: "get",
      data
    });
  },

  //收藏商品
  collectList(data) {
    return request.request({
      url: `/api/front/collect/user`,
      method: "get",
      data
    });
  },

  //取消收藏
  cancelCollect(data) {
    return request.request({
      url: `/api/front/collect/delete`,
      method: "post",
      data
    });
  },

  //地址列表
  addressList(data) {
    return request.request({
      url: `/api/front/address/list`,
      method: "get",
      data
    });
  },

  //省市区
  cityList(data) {
    return request.request({
      url: `/api/front/city/list`,
      method: "get",
      data
    });
  },

  //保存地址
  addressEdit(data) {
    return request.request({
      url: `/api/front/address/edit`,
      method: "post",
      data
    });
  },

  //更改默认地址
  addressSetDefault(data) {
    return request.request({
      url: `/api/front/address/default/set`,
      method: "post",
      data
    });
  },

  //删除地址
  addressDel(data) {
    return request.request({
      url: `/api/front/address/del`,
      method: "post",
      data
    });
  },

  //地址详情
  addressDetail(data) {
    return request.request({
      url: `/api/front/address/detail/${data}`,
      method: "get",
      data
    });
  },

  //优惠券
  couponList(data) {
    return request.request({
      url: `/api/front/coupon/list`,
      method: "get",
      data
    });
  },

  //购物车有多少商品
  cartCount(data) {
    return request.request({
      url: `/api/front/cart/count`,
      method: "get",
      data
    });
  },

  //购物车列表
  cartList(data) {
    return request.request({
      url: `/api/front/cart/list`,
      method: "get",
      data
    });
  },

  //购物车数量
  cartNum(data) {
    return request.request({
      url: `/api/front/cart/num`,
      method: "post",
      data
    });
  },
}